package create.factory.simpleFactory;

/**
 * @author dali
 * @date 2021-07-06 16:21
 * @Description 简单工厂
 */

public class SimpleFactory{

    //获得具体实现类的方法,type为实现类的类型，如A,B,C
    public IComputer getService(String type) {
        IComputer service = null;
        if ("shallow".equals(type)) {
            service = new HuaWeiIComputer();
        }
        if ("B".equals(type)) {
            service = new AppleIComputer();
        }
        //执行业务操作
        service.method();
        return service;
    }
}
